cmake_minimum_required(VERSION 3.22.1)

project(uvc_camera)

#添加宏定义，设置为openharmony模式
add_definitions(-D__OPENHARMONY__)

add_library(uvc_camera SHARED
            camera_uvc.cpp
            camera/UvcPreview.cpp
            camera/UvcCamera.cpp
            camera/img_util.cpp
            utils/napi_utils.cpp
            render/PluginManager.cpp
            render/PluginWindowRender.cpp
            libuvc/src/ctrl.c
            libuvc/src/ctrl-gen.c
            libuvc/src/device.c
            libuvc/src/diag.c
            libuvc/src/frame.c
#           libuvc/src/frame-mjpeg.c
            libuvc/src/init.c
            libuvc/src/stream.c
            libuvc/src/misc.c
            libusb/core.c
            libusb/descriptor.c
            libusb/hotplug.c
            libusb/io.c
            libusb/sync.c
            libusb/strerror.c
            libusb/os/linux_usbfs.c
            libusb/os/events_posix.c
            libusb/os/threads_posix.c
            libusb/os/linux_netlink.c
)


target_include_directories(uvc_camera PRIVATE
        ${CMAKE_CURRENT_SOURCE_DIR}/libuvc
        ${CMAKE_CURRENT_SOURCE_DIR}/utils/headers
        ${CMAKE_CURRENT_SOURCE_DIR}/render/headers
        ${CMAKE_CURRENT_SOURCE_DIR}/camera/headers
        ${CMAKE_CURRENT_SOURCE_DIR}/libusb
        ${CMAKE_CURRENT_SOURCE_DIR}/libusb/os
        ${CMAKE_CURRENT_SOURCE_DIR}/libuvc/include
        ${CMAKE_CURRENT_SOURCE_DIR}/rapidjson/include
        ${CMAKE_CURRENT_SOURCE_DIR}/libjpeg-turbo
         ${CMAKE_CURRENT_SOURCE_DIR}/opencv
)

target_link_libraries(uvc_camera
            libace_napi.z.so
            hilog_ndk.z
            libace_ndk.z.so
            libnative_window.so
            librawfile.z.so

            ${CMAKE_CURRENT_SOURCE_DIR}/../../../libs/${OHOS_ARCH}/libopencv_core.so.410
            ${CMAKE_CURRENT_SOURCE_DIR}/../../../libs/${OHOS_ARCH}/libopencv_imgcodecs.so.410
            ${CMAKE_CURRENT_SOURCE_DIR}/../../../libs/${OHOS_ARCH}/libopencv_imgproc.so.410
)